﻿@model DAEProde.Tasks.ViewModels.EditTournamentViewModel

@{
    ViewBag.Title = "ViewTeams";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Agregar/Quitar equipos al Toreno</h2>

@using (Html.BeginForm("ViewTeams", "TournamentManager")) {
    @Html.ValidationSummary("Please note the following:")
    @Html.AntiForgeryToken()

    <fieldset>        
        <legend>Torneo - @Model.Tournament.Name</legend>

        @Html.HiddenFor(m => m.Tournament.Id)

        <div class="editor-label">
            @Html.LabelFor(m => m.Tournament.Teams)
        </div>
        <div class="editor-field">
            @foreach (var team in Model.AvaileableTeams) {
                <input id="Tournament_Team_@team.Id" type="checkbox" name="tournament.Teams" value="@team.Id" 
                    @(Model.Tournament.Teams.Contains(team) ? "checked=\"checked\"" : "") />
                <label for="Tournament_Team_@team.Id">@team.Name</label><br />
            }

            @Html.ValidationMessageFor(m => m.AvaileableTeams)
        </div>

        <p>
            <input type="submit" value="Guardar" /> 
            @Html.ActionLink("Cancelar", "Index")
        </p>
    </fieldset>
}